home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- BorderStyle = 1 'Fixed Single
- Caption = "Mabry Volume Sample"
- ClientHeight = 2760
- ClientLeft = 4755
- ClientTop = 2340
- ClientWidth = 3135
- Height = 3165
- Left = 4695
- LinkTopic = "Form1"
- LockControls = -1 'True
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 2760
- ScaleWidth = 3135
- Top = 1995
- Width = 3255
- Begin VB.CommandButton Command2
- Caption = "Refresh"
- Height = 375
- Left = 840
- TabIndex = 6
- Top = 2280
- Width = 1335
- End
- Begin VB.Timer Timer1
- Enabled = 0 'False
- Interval = 500
- Left = 120
- Top = 960
- End
- Begin VB.CommandButton Command1
- Caption = "Start Beeps"
- Default = -1 'True
- Height = 375
- Left = 840
- TabIndex = 0
- Top = 1920
- Width = 1335
- End
- Begin VB.CheckBox chkLock
- Caption = "Lock Channels"
- Height = 255
- Left = 840
- TabIndex = 3
- Top = 1560
- Width = 1455
- End
- Begin VB.CheckBox chkMuteRight
- Caption = "Mute Right"
- Height = 255
- Left = 840
- TabIndex = 2
- Top = 1200
- Width = 1215
- End
- Begin VB.CheckBox chkMuteLeft
- Caption = "Mute Left"
- Height = 255
- Left = 840
- TabIndex = 1
- Top = 960
- Width = 1215
- End
- Begin VB.VScrollBar vscrRight
- Height = 1815
- Left = 2760
- Max = 0
- Min = 32767
- TabIndex = 5
- Top = 240
- Width = 255
- End
- Begin VB.VScrollBar vscrLeft
- Height = 1815
- Left = 2400
- Max = 0
- Min = 32767
- TabIndex = 4
- Top = 240
- Width = 255
- End
- Begin VolumeControl.MVolume MVolume1
- Left = 120
- Top = 1440
- _ExtentX = 847
- _ExtentY = 847
- End
- Begin VB.Label Label6
- Alignment = 2 'Center
- Caption = "Min"
- Height = 255
- Left = 2400
- TabIndex = 12
- Top = 2160
- Width = 495
- End
- Begin VB.Label Label5
- Alignment = 2 'Center
- Caption = "Max"
- Height = 255
- Left = 2400
- TabIndex = 11
- Top = 0
- Width = 495
- End
- Begin VB.Label lblRight
- Height = 255
- Left = 840
- TabIndex = 10
- Top = 480
- Width = 1335
- End
- Begin VB.Label lblLeft
- Height = 255
- Left = 840
- TabIndex = 9
- Top = 120
- Width = 1335
- End
- Begin VB.Label Label2
- Alignment = 1 'Right Justify
- Caption = "Right:"
- Height = 255
- Left = 120
- TabIndex = 8
- Top = 480
- Width = 615
- End
- Begin VB.Label Label1
- Alignment = 1 'Right Justify
- Caption = "Left:"
- Height = 255
- Left = 120
- TabIndex = 7
- Top = 120
- Width = 615
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Private fLocked As Boolean
- Private Sub chkLock_Click()
- If chkLock.Value = vbChecked Then
- fLocked = True
- Else
- fLocked = False
- End If
- End Sub
- Private Sub chkMuteLeft_Click()
- If chkMuteLeft.Value = vbChecked Then
- MVolume1.MuteLeft = True
- Else
- 'we are un-muting -- let's see if
- 'the user has messed with the volume
- 'from the system applet
- MVolume1.MuteLeft = False
- MVolume1.Refresh
- vscrLeft.Value = MVolume1.VolumeLeft
- vscrRight.Value = MVolume1.VolumeRight
- lblLeft.Caption = Hex$(MVolume1.VolumeLeft)
- lblRight.Caption = Hex$(MVolume1.VolumeRight)
- End If
- End Sub
- Private Sub chkMuteRight_Click()
- If chkMuteRight.Value = vbChecked Then
- MVolume1.MuteRight = True
- Else
- 'we are un-muting -- let's see if
- 'the user has messed with the volume
- 'from the system applet
- MVolume1.MuteRight = False
- MVolume1.Refresh
- vscrLeft.Value = MVolume1.VolumeLeft
- vscrRight.Value = MVolume1.VolumeRight
- lblLeft.Caption = Hex$(MVolume1.VolumeLeft)
- lblRight.Caption = Hex$(MVolume1.VolumeRight)
- End If
- End Sub
- Private Sub Command1_Click()
- If Timer1.Enabled = False Then
- Timer1.Enabled = True
- Command1.Caption = "Stop Beeps"
- Else
- Timer1.Enabled = False
- Command1.Caption = "Start Beeps"
- End If
- End Sub
- Private Sub Command2_Click()
- 'if you change the volume from the
- 'Windows Speaker applet, you can detect
- 'the change after invoking the Refresh
- 'method.
- '
- 'Please note that the Volume control supports
- 'the full range of signed integer values (&H0000 thru &HFFFF)
- 'but the sample only supports &H0000 thru &H7FFF so the
- 'scrollbars could easily track the volume in a linear fashion.
- 'If you use the Windows volume applet to change the volume to
- '&H8000 or above, an invalid property setting error will occur
- 'because this is outside of the range of the scroll bars.
- '
- 'see the Form_Load event for details on trapping this in this
- 'sample. To use the entire range, extra code would be necessary
- 'to make the scroll bars behave in a linear fashion.
- MVolume1.Refresh
- vscrLeft.Value = MVolume1.VolumeLeft
- vscrRight.Value = MVolume1.VolumeRight
- lblLeft.Caption = Hex$(MVolume1.VolumeLeft)
- lblRight.Caption = Hex$(MVolume1.VolumeRight)
- End Sub
- Private Sub Form_Load()
- 'the system and the Volume control tracks the volume levels
- 'using a range of &H0000 to &HFFFF. The sample uses
- 'Scrollbars to adjust the range in a linear fashion, but
- 'when the upper bit is set (ie -- above &H7FFF) the
- 'linear effect of the scrollbars is lost. So, although
- 'the control is capable of supporting the entire range of
- '&H0 to &HFFFF, the sample only demonstrates a range of
- '&H0 to &H7FFF so the Scrollbars could be easily used.
- '
- 'The following statements trap values greater than &H7FFF
- If MVolume1.VolumeLeft < 0 Then
- MVolume1.VolumeLeft = &H7FFF
- End If
- If MVolume1.VolumeRight < 0 Then
- MVolume1.VolumeRight = &H7FFF
- End If
- vscrLeft.Value = MVolume1.VolumeLeft
- vscrRight.Value = MVolume1.VolumeRight
- lblLeft.Caption = Hex$(MVolume1.VolumeLeft)
- lblRight.Caption = Hex$(MVolume1.VolumeRight)
- End Sub
- Private Sub Timer1_Timer()
- Beep
- End Sub
- Private Sub vscrLeft_Change()
- MVolume1.VolumeLeft = vscrLeft.Value
- If fLocked = True Then
- vscrRight.Value = vscrLeft.Value
- End If
- lblLeft.Caption = Hex$(MVolume1.VolumeLeft)
- End Sub
- Private Sub vscrLeft_Scroll()
- MVolume1.VolumeLeft = vscrLeft.Value
- If fLocked = True Then
- vscrRight.Value = vscrLeft.Value
- End If
- lblLeft.Caption = Hex$(MVolume1.VolumeLeft)
- End Sub
- Private Sub vscrRight_Change()
- MVolume1.VolumeRight = vscrRight.Value
- If fLocked = True Then
- vscrLeft.Value = vscrRight.Value
- End If
- lblRight.Caption = Hex$(MVolume1.VolumeRight)
- End Sub
- Private Sub vscrRight_Scroll()
- MVolume1.VolumeRight = vscrRight.Value
- If fLocked = True Then
- vscrLeft.Value = vscrRight.Value
- End If
- lblRight.Caption = Hex$(MVolume1.VolumeRight)
- End Sub
-